'use strict';

/**
 * 函数工具
 */

//去抖
const debounce = ( func, space = 300, cxt = null ) => {
    let timer
    return function ( ...args ) {
        if ( timer == null ) {
            func.apply( cxt, args )

            timer = setTimeout( () => {
                clearTimeout( timer )
                timer = null
            }, space )
        }
    }
}

export {
    debounce
}